package com.ly.hotel.model;

import java.util.Calendar;
import java.util.TimeZone;


public class TimingMsgBean implements java.io.Serializable {

	/**
	 * id	滚动消息ID
		name	消息名称
		repeatType	重复的类型（仅一次，每日，每周一..每周日，每月1日...每月31日）
		beginTime	消息开始时间
		endTime	消息结束时间
		createTime	创建时间
		content	消息内容
		status	状态值（10：正常，-10：停用）
	 */
	private static final long serialVersionUID = 1L;
	// Constructors
	private Integer id;
	private String name;
	private String repeatType;
	private String beginTime;
	private String endTime;
	private java.util.Date createTime;
	private String content;
	private Integer status;
	
	public Integer getId() {
		return id;
	}


	public String getName() {
		return name;
	}


	public String getRepeatType() {
		return repeatType;
	}


	public String getBeginTime() {
		return beginTime;
	}


	public String getEndTime() {
		return endTime;
	}


	public java.util.Date getCreateTime() {
		return createTime;
	}


	public String getContent() {
		return content;
	}


	public Integer getStatus() {
		return status;
	}

	public long getBeginTimeInMillis(){
		long selectTime = 0;
		String info[] = beginTime.split(":");
		if(info.length == 3){
			int mMinute = Integer.parseInt(info[1]);
			int mHour = Integer.parseInt(info[0]);
			Calendar calendar = Calendar.getInstance();  
			calendar.setTimeInMillis(System.currentTimeMillis());  
			// 这里时区需要设置一下，不然会有8个小时的时间差  
			calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));  
			calendar.set(Calendar.MINUTE, mMinute);  
			calendar.set(Calendar.HOUR_OF_DAY, mHour);  
			calendar.set(Calendar.SECOND, 0);  
			calendar.set(Calendar.MILLISECOND, 0);  
			// 选择的定时时间  
			selectTime = calendar.getTimeInMillis();  
		}else{
			selectTime = 0;
		}
		
		return selectTime;
	}
	
	public long getEndTimeInMillis(){
		long selectTime = 0;
		String info[] = endTime.split(":");
		if(info.length == 3){
			int mMinute = Integer.parseInt(info[1]);
			int mHour = Integer.parseInt(info[0]);
			Calendar calendar = Calendar.getInstance();  
			calendar.setTimeInMillis(System.currentTimeMillis());  
			// 这里时区需要设置一下，不然会有8个小时的时间差  
			calendar.setTimeZone(TimeZone.getTimeZone("GMT+8"));  
			calendar.set(Calendar.MINUTE, mMinute);  
			calendar.set(Calendar.HOUR_OF_DAY, mHour);  
			calendar.set(Calendar.SECOND, 0);  
			calendar.set(Calendar.MILLISECOND, 0);  
			// 选择的定时时间  
			selectTime = calendar.getTimeInMillis();  
		}else{
			selectTime = 0;
		}
		
		return selectTime;
	}
}